package mianxiangduixiang.Test7;

import java.io.*;

/**
 * @Author JetZhang
 * Package:mianxiangduixiang.Test7
 * Description:使用FileReader和FileInputStream读取带中文注释的java文件 并输出  用FileWrite和FileOutputStream写入copyfile1.txt和copyfile2.txt中
 * @Date 2021/11/18
 */
public class T2 {
    public static void main(String[] args) throws FileNotFoundException {
        try {
            FileReader fileReader = new FileReader("Test.java");
            FileInputStream fileInputStream = new FileInputStream("Test.java");
            InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8");

            BufferedReader bufferedReader = new BufferedReader(fileReader);
            int content;
            while ((content = inputStreamReader.read()) != -1) {
                System.out.print((char) content);
            }

            System.out.println("\n");
            String str = bufferedReader.readLine();
            while (str != null) {
                System.out.println(str);
                str = bufferedReader.readLine();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
